//
// Created by 吴喆 on 2020/3/7.
//

#ifndef SUMMER_DEMOPLAYER_H
#define SUMMER_DEMOPLAYER_H

#import <box2d/box2d.h>

#import "../util/Console.h"
#import "../engine/ResourceManager.h"
#import "../engine/Player.h"
#import "../engine/Scene.h"
#import "../engine/Renderer.h"
#import "automation/DemoPlayerStateMachine.h"
#import "automation/DirectionStateMachine.h"
#import "automation/AtkStateMachine.h"
#import "DemoBullet.h"

class DemoPlayer : public Player {
public:
    explicit DemoPlayer(Scene *scene_);

    void render() override;

    void update() override;

    void launchBullet();

    float atkInterval = 0.2f;

    void beAtked(GameObject *gameObject) override;

private:
    void init() final;

    void initPlayerStateMachine() final;

    void initGameObject() override;

    std::list<DemoBullet *> bullets;

    bool isAtked = false;
    float AtkedStateInterval = 0.1f;
    // current interval
    float interval = 0;

    /**
     * after get attacked, player invincible state interval
     */
    float AtkedInvincibleInterval = 1.0f;
    float invincibleInterval = 0;
};


#endif //SUMMER_DEMOPLAYER_H
